﻿using System;
using System.Windows;

namespace Builderator.Firefly.Windows
{
    /// <summary>
    /// Interaction logic for DebugWindow.xaml
    /// </summary>
    public partial class DebugWindow : Window
    {
        public bool Dispose
        {
            get;
            set;
        }

        public DebugWindow()
        {
            InitializeComponent();

            this.Dispose = false;
        }

        public void DebugMessage(string message)
        {
            this.Dispatcher.Invoke(
                new Action(
                    delegate()
                    {
                        this.debugRun.Text += message + "\n";

                        this.debugRichTextBox.ScrollToEnd();
                    }
            ));
        }

        private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (!this.Dispose)
            {
                e.Cancel = true;

                this.Hide();
            }
        }
    }
}
